Create proc proc_insertDonViTinh
(
 @MaVatTu		varchar(10),
 @DonViTinh		nvarchar(20),
 @GiaTriQuiDoi	float,
 @LaMacDinh		bit
)
as
 insert into DonViTinh values (@MaVatTu,@DonViTinh,@GiaTriQuiDoi,@LaMacDinh)

Create proc proc_insertVatTuHangHoa
(
 @MaVatTu		varchar(10),
 @TenVatTu		nvarchar(100),
 @DonViTinh		nvarchar(20)
)
as
begin
 insert into VatTuHangHoa values (@MaVatTu, @TenVatTu)
 exec proc_insertDonViTinh @MaVatTu,@DonViTinh,1,1
end

Create proc proc_insertKho
(
 @MaKho			varchar(10),
 @TenKho			nvarchar(100)
)
as
 insert into Kho values (@MaKho,@TenKho)
 
Create proc proc_insertTienTe
(
 @KyHieu varchar(10),
 @LoaiTien nvarchar(100),
 @TyGia float
)
as
INSERT INTO [QuanLyKho].[dbo].[TienTe]VALUES(@KyHieu,@LoaiTien,@TyGia)
GO

Create proc proc_insertNhapKhau
(
 @SoChungTu		varchar(10),
 @Ngay			datetime,
 @TenNhaCungCap	nvarchar(100),
 @MaHopDong		varchar(10),
 @LoaiTien		varchar(10),
 @DaXacNhan		bit,
 @DaTraTien		bit,
 @TongCong		float,
 @TenTaiKhoan 	nvarchar(20),
 @GhiChu		ntext
)
as
begin
 declare @MaNhaCungCap varchar(10),
		 @MaTaiKhoan int
		 
 set @MaHopDong = dbo.func_getMaNhaCungCapFromTenNhaCungCap(@TenNhaCungCap)
 set @MaTaiKhoan = dbo.func_getMaTaiKhoanFromTenTaiKhoan(@TenTaiKhoan)
		 
 insert into QuanLyKho.dbo.NhapKhau values (@SoChungTu,@Ngay,@MaNhaCungCap,@MaHopDong,@LoaiTien,@DaXacNhan,@DaTraTien,@TongCong,@MaTaiKhoan,@GhiChu)
end
go